package com.gitee.easyopen;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

import com.gitee.easyopen.doc.ApiDocBuilder;

public class ApiContext {
    private static ThreadLocal<HttpServletRequest> threadLocalReq = new ThreadLocal<HttpServletRequest>();
    private static ApiDocBuilder apiDocBuilder;

    public static void setRequest(HttpServletRequest request) {
        threadLocalReq.set(request);
    }

    public static HttpServletRequest getRequest() {
        return threadLocalReq.get();
    }

    public static Locale getLocal() {
        return getRequest().getLocale();
    }

    public static ApiDocBuilder getApiDocBuilder() {
        return apiDocBuilder;
    }

    public static void setApiDocBuilder(ApiDocBuilder apiDocBuilder) {
        ApiContext.apiDocBuilder = apiDocBuilder;
    }

}
